<template>
	<div class="main-content ">
		<div class="menu-nav">
			<div class="menu-content layout-column">
				<button v-for="item in categories" v-gesture:tap.stop.prevent="toNavContent(item.id, $index)"  v-bind:class="{ 'active': styleObject.nav.navIndex == $index}" >{{item.name}}</button>
				<button class="last">123</button>
			</div>
		</div>
		<div class="nav-content" id='inventories_content'>
			<!-- <div class="nav-title abs" id="nav_title">{{(categories[styleObject.nav.navIndex - 1] && categories[styleObject.nav.navIndex - 1].name) || (categories[0] && categories[0].name)}}</div> -->
			<div v-if="contentShow" class="content-wrap" id='inventories_wrap'>
				 <!-- v-bind:class="{ 'active': styleObject.nav.navIndex == $index}" -->
				<dl v-for="category in categories" id="category_{{category.id}}" class="content-dl j_list_inventory">
					<dt class="dt">{{category.name}}</dt>
					<dd v-for='item in inventories[category.id]' class="item" v-gesture:tap.stop.prevent="toInventoryInfo(item)">
						<div class="img-warp"><img class="db lazyload_img divtcvm" data-src="http://app.menpuji.com{{item.pic}}" src="/wexin-orders/assets/images/default-inventory-img.png" onerror="this.src='/wexin-orders/assets/images/default-inventory-img.png'"></div>
						<div class="item-r">
							<p class="text-accent text-color-defaul ell">{{item.name}}</p>
							<p class="text-muted text-color-info">月售 {{item.qty||0}} {{item.unit.name}}</p>
							<p class="text-accent text-color-accent">￥{{item.price}}</p>
						</div>
						<div class="item-abs">
							<i class="iconfont icon-inventory-subtract"  v-bind:inventory='item' v-inventory-qty-valid="item.name | wrap item.id order.cart" v-inventory-qty-show="item.name | wrap item.id order.cart"><span v-gesture:tap.stop.prevent="subtrackInventory(item)" class="tap"></span></i><!--
							--><span class="inventory-count" v-text="item.name | wrap item.id order.cart" v-inventory-qty-show="item.name | wrap item.id order.cart"></span><!--
							--><i class="iconfont icon-inventory-add"><span class="tap" v-gesture:tap.prevent.stop="addInventory(item)"></span></i>
						</div>
					</dd>
				</dl>
				<button class="last"></button>
			</div>
			<div v-else >加载中</div>
		</div>
	</div>
	<footer class="bottom-nav cart-footer">
		<div class="cartl divvmr" v-gesture:touchstart.stop.prevent="transformIsShowCart()"><i class="iconfont icon-shoppingcart"></i><span class="cart-count text-muted">{{order.cart.qty}}</span></div>
		<div class="cartct">￥{{order.subtotal || 0}}</div>
		<div class="cartr" v-bind:class="{ 'disabled': !order.cart.qty}" v-gesture:touchstart.stop.prevent="transformIsShowConfirmOrder()">{{order.subtotal?"去下单":"请点单"}}</div>
	</footer>
	<!-- 商品详情界面 -->
	<!-- <inventory-info v-if="inventoryInfo.show" :inventory-info="inventoryInfo" :cart.sync="order.cart" :inventory-option-group.sync="inventoryOptionGroup"></inventory-info> -->
	<!-- 购物车 -->
	<shopping-cart v-if="isShowShoppingCart" :inventory-option-group.sync="inventoryOptionGroup" :cart.sync="order.cart" :is-show-shopping-cart.sync="isShowShoppingCart"></shopping-cart>
	<!-- 商品选项 -->
	<inventory-option-group v-if="inventoryOptionGroup.show" :cart.sync='order.cart' :inventory-option-group.sync="inventoryOptionGroup"></inventory-option-group>
	<!-- 开始页面 -->
	<!-- <start-page v-if="isShowStartPage" :app-url-info="appUrlInfo" :is-show-confirm-order.sync="isShowConfirmOrder" :is-show-start-page.sync="isShowStartPage" :start-info.sync="startInfo"></start-page> -->
	<!-- 路由 -->
	<router-view :is-show-confirm-order.sync="isShowConfirmOrder" :app-url-info="appUrlInfo" :is-show-start-page.sync="isShowStartPage" :start-info.sync="startInfo"></router-view>

	<mpj-toast :show.sync=toastMsg.show :time=toastMsg.time :type=toastMsg.type>{{toastMsg.content}}</mpj-toast>
	<toast class="toast" :type=loadingMsg.type v-show="loadingMsg.show">{{loadingMsg.content}}</toast>
	<mpj-dialog :options="mpjDialogOpts"></mpj-dialog>
</template>

<style lang='sass'>
	@import '../assets/sass/global/themes.scss';
	footer{position: absolute;bottom: 0;width: 100%}
	#app.input-upspring #inventories_wrap{pointer-events:none;}
	.main-content{
		flex: 1;
		flex-direction: row;
		display: flex;
		font-size: pxTorem(12px);
		position: absolute;;
		top: 0;
		bottom: 0;
		width: 100%;
	}
	.menu-nav{
		display: flex;
		flex-direction: column;
		overflow-y: scroll;
		background: $bg-color-deafult;
		width:89px;
	}
	.menu-nav .menu-content {border-right: 1px solid  #e3e3e3;box-sizing:content-box;}
	.menu-nav button{min-height:30px;position: relative;color:#5c5c5c;padding: 20px 14px;text-align: left;font-size: $font-size-default; box-sizing:content-box ;width: 60px;border-bottom: 1px solid  #e3e3e3;background: $bg-color-deafult}
	.menu-nav button.active{background: white;color:black;border-right:1px solid white;}
	.menu-nav button.last,.content-wrap button.last{height: 0; min-height: 50px;padding: 0;border: none;font-size: 0;}
	.menu-nav button.last{padding: 0 14px;border-right: 1px solid #f7f7f7;}
	.menu-nav button.active::before{content: "";top:10px;bottom: 10px;position: absolute;background: $bg-color-primary;width: 5px;left: 0;}
	.sec-content::-webkit-scrollbar,.menu-nav::-webkit-scrollbar,.content-dl::-webkit-scrollbar,.nav-content::-webkit-scrollbar {display:none;}

	/*.nav-content::-webkit-scrollbar {
    width:5px;
    height: 2em
	}*/
	/*.nav-content::-webkit-scrollbar-button {
	    background: #ccc
	}*/
	/*.nav-content::-webkit-scrollbar-track-piece {
	    background: #888
	}*/
	/*.nav-content::-webkit-scrollbar-thumb {
	    background: #eee
	}*/
	.toast{position:fixed;z-index:100;}
	.nav-content{
		flex: 1;
		overflow-y: scroll;
		-webkit-overflow-scrolling: touch;
		overflow-scrolling: touch;
	}
	.content-wrap{
		width: 100%;
		box-sizing: border-box;
		position: relative;
		transform: translateZ(0);
	}
	.content-dl{}
	.content-dl .dt{position: relative;z-index: 7;margin-left: 1px;}
	.content-dl .dt,.nav-content .nav-title{background: $bg-color-deafult;line-height: 44px;font-size: $font-size-default;text-indent:20px}
	.nav-content .nav-title{margin: 0 0 0 .33rem;position: fixed;width: 100%;z-index: 8;box-sizing:border-box;}
	.content-dl .item{
		border-bottom: 1px solid #e3e3e3;
		display: flex;
		position: relative;
		padding: 13px 0 ;
		margin-left:.33rem;
	}
	.content-dl .item:last-child{
		border-bottom: 1px solid white;
	}
	.content-dl.active:before{height: 44px;width: 100%;content: "";display: block;}
	.content-dl.active dt{position: fixed; top: 0;width: 100%;z-index: 7;}
	.content-dl .item .item-abs{position: absolute;right: 0;top:45px;line-height: 30px;right: .30666rem;}
	.content-dl .item .item-abs > i,.content-dl .item .item-abs > i.disabled {color:$font-color-primary!important;font-size: 30px;vertical-align: middle;position: relative;}
	.content-dl .item .item-abs > i.require.disabled{color:#e3e3e3!important;pointer-events:none;}
	.content-dl .item .item-abs > i:active{color:$btn-color-active !important;}
	.content-dl .item .item-abs i.icon-inventory-subtract .tap,.content-dl .item .item-abs i.icon-inventory-delete .tap{position: absolute;left: -10px;right: -10px;  top: -10px;  bottom: -10px;}
	.content-dl .item .item-abs i.icon-inventory-add .tap{position: absolute;left: -10px;right: -10px;  top: -10px;  bottom: -10px;}
	.content-dl .item .item-abs .inventory-count{width: 25px;display: inline-block;text-align: center;vertical-align: middle;}
	.content-dl .item .img-warp{background: #E2E2E2;width: 64px;height: 64px;position: relative;}
	.content-dl .item img{width: 100%;height: 100%;}
	.content-dl .item .item-r{
		flex-direction: column;
		justify-content: space-between;
		display: flex;
		padding: 0 0 0 .33rem;
		flex:1;
	}
	.content-dl .item .item-r p:first-child{padding-right: .33rem};
	.content-dl .item .item-r p:last-child{text-indent:-3px}
	.cart-footer{background-color: rgba(0, 0, 0, 0.8); color: white;line-height: 50px;z-index:10;}
	.cart-footer .icon-shoppingcart{font-size: 30px;line-height: normal;vertical-align:super;}
	.cart-footer > div{line-height: 50px;float: left;}
	.cart-footer > .cartl{height: 30px;width: 2.2rem;text-align: center;box-sizing: border-box;border-right:1px solid rgba(255, 255, 255, 0.8);position: relative}
	.cart-footer > .cartl .cart-count{position: absolute;width: 16px;height: 16px;background: #fd4c3c;border-radius:9999px;margin-left: -10px;margin-top:-2px;font-size: 10px;line-height: 17px;}
	.cart-footer > .cartct{width:5rem;font-size: $font-size-large;padding-left: 10px;box-sizing: border-box}
	.cart-footer > .cartr{width: 2.8rem;font-size: $font-size-accent;color: white;background:$font-color-primary;text-align: center;float:right;}
	.cart-footer > .cartr:active{background:$btn-color-active !important;}
	.cart-footer > .cartr.disabled{background:none;color:#CACACA;pointer-events:none;}
</style>


<script type="text/javascript">
	/*懒加载*/
	import MpjToast from './../components/toast/mpj-toast'
	import TopNav from '../components/top-nav';
	import Inventories from '../business/inventories';
	import Order from '../business/order';
	import vueCo from 'vue-co';
	import Table from '../business/table';
	import lodash from 'lodash';
	import checkOrder from "../business/check-order";
	import {store, storeWithExpiration} from '../lib/store';
	import LazyLoadImg from '../lib/lazyloadimg';
	import {setStateApp,getOpenid,ordering} from "../vuex/actions";
	import api from "../api";
	// import ClientType from '../lib/client-type';
	export default vueCo({
		vuex:{
		    getters:{
		      vuexData: (state) =>state.app.x,
  				toastMsg: (state) => state.msg.toastMsg,
					route: (state)=>state.route,
					app:(state)=>state.app,
					loadingMsg:(state)=>state.msg.loadingMsg,
					mpjDialogOpts: ({msg}) => msg.mpjDialogOpts
		    },
				actions:{
					setStateApp,getOpenid
				}
		  },
		data: function(){
			return {
				inventoryOptionGroup: {
					show:false,
					inventory:{}
				},//选项组卡的数据
				inventoryInfo:{
					show:false,
					inventory:{}
				},//商品选项的数据
				inventories: {}, //商品
				originalInventories:[],
				categories:[], //分类
				hiddenInitData: {},
				order: {},
				contentShow:false,
				isShowShoppingCart:false,
				isShowStartPage:true,
			  isShowConfirmOrder:false,
			  isShowCompleteOrder:false,
				styleObject: {
					nav:{
						navIndex:0
					}
				},
				appUrlInfo: {},
				startInfo: {show:false,error:false,msg:""},
				allOrder: [],
				isBtn:false
			}
		},
		created: function(){
			//  debugger
			let urlPath = location.pathname;
			let regexp = /\/(\w*)\/(\w*)/;
			let urlinfo = regexp.exec(urlPath);
			this.appUrlInfo.storeId = "";

			this.appUrlInfo.tableId = urlinfo[2];
			// if(route.state.)

			this.order = new Order(this.appUrlInfo.storeId, this.appUrlInfo.tableId);
		},
		beforeCompile: function*(){
			const self = this;
			// console.log("1");
			// hack在微信IOS webview中无法修改document.title的情况 $.isWeixin() && $.isIOS() ClientType.isWeixin() && ClientType.isIOS()
        // if (true) {
				// 	console.log("2");
				// 	let frame = document.createElement('iframe');
				// 	frame.src="/favicon.ico";
				// 	document.body.appendChild(frame);
				// 	setTimeout(function(){
				// 		console.log("3");
				// 		document.body.removeChild(frame);
				// 		document.title = self.appUrlInfo.storeName || "微信点单";
				// 	}, 100);
				//
        //     // let elem = $('<iframe src="/st/images/icon144.png"></iframe>');
        //     // $iframe.on('load', function () {
        //     //     setTimeout(function () {
        //     //         $iframe.off('load').remove();
        //     //     }, 0);
        //     // }).appendTo('body');
        // }

				// 原生触发

				// function changeTitle(title){
				// 	var body = document.getElementsByTagName('body')[0];
				// 	document.title = title;
				// 	var iframe = document.createElement("iframe");
				// 	iframe.setAttribute("src", "/favicon.ico");
				//
				// 	iframe.addEventListener('load', function() {
				// 		setTimeout(function() {
				// 			iframe.removeEventListener('load');
				// 			document.body.removeChild(iframe);
				// 		}, 0);
				// 	});
				// 	document.body.appendChild(iframe);
				// }
				// document.getElementById('demo2').ontouchend = function(){
				// 	changeTitle('demo2 title');
				//
				// }

		},
		ready: function*(){


			const self = this;
			let initData;
			let urlParam ;
			const routerQuery = self.route.query;
			self.$router.go({name:"start-page",query:{init:true,show:true,isShowStartPage:true},params:{show:true}});

			if(routerQuery.state){
				let queryL = routerQuery.state.indexOf("#");
				queryL=queryL>-1?queryL:routerQuery.state.length;
				const paramStr= routerQuery.state.substring(0,queryL);
				urlParam= JSON.parse(paramStr);
				store.set('urlParam', urlParam);
			}
			if(!urlParam&&window.location.href.indexOf("wechatorder")>-1){
				//快餐版
				urlParam = store.get('urlParam');
				urlParam.openid = store.get('openid');
			}
			self.setStateApp(urlParam);
			console.log(self.app.model);
			switch (self.app.model) {
				case 1:
					initData = yield Table.getWxInitData(self.$http, self.appUrlInfo.tableId);
					break;
				case 2:
					{
						//设置tableId,storeId
						self.order.storeId = self.app.storeId;
						self.order.extended.numberPlate = self.app.numberPlate;
						//todo
						self.order.sourceid="mpj/mstore/web-ordering";

						try {
							let result;
							result = yield api.getWxInitByStoreId(self.app.storeId);
							initData = result.data;

							self.order.extended.numberPlateUnit = initData.numberPlateUnit||"桌子";
							let resultOpenid={};
							if(urlParam.openid){
								resultOpenid={openid:urlParam.openid}
							}else {

								result = yield api.getOpenid({code:routerQuery.code, storeId:self.app.storeId});
								if(result.data.code==200){
									resultOpenid=result.data.data;
								} else {
									initData = {"isValidTableId":false,"msg":"获取openid失败",e:result.data}
								}
							}
							self.getOpenid(resultOpenid);
							// initData = {"isValidTableId":true,"storeId":self.appUrlInfo.tableId,"moduleInstalled":true,"terminalConfigured":true};
							self.order.openid = resultOpenid.openid;
							store.set('openid', resultOpenid.openid);
						} catch (e) {
							console.error(e);
							initData = {"isValidTableId":false,"msg":"微信点单加载失败，请联系商家！",e:e}
						}
				}

					break;
					default:
				}

			if(!initData.isValidTableId){
 				self.startInfo.error = true;
				if(self.app.model==2){
					self.startInfo.msg = initData.msg;
				}else {
					self.startInfo.msg = "台桌二维码错误，请联系服务员！";
				}
				return;
 			} else if(!initData.moduleInstalled){
 				self.startInfo.error = true;
				self.startInfo.msg = "商家未安装微信点单模块，请联系服务员！";
				return;
 			} else if(!initData.terminalConfigured){
 				self.startInfo.error = true;
				self.startInfo.msg = "商家未设置网络订单终端，请联系服务员！";
				return;
 			} else if(!initData.wechatpay && self.app.model!=1){
				self.startInfo.error = true;
				self.startInfo.msg = "商家未安装微信支付模块，请联系服务员！";
				return;
			}
			else {
				self.appUrlInfo.storeId = initData.storeId;
				self.order.storeId = initData.storeId;
			}

			let _tabledata={};
			switch (self.app.model) {
				case 1:
					_tabledata = yield Table.getTabledata(self.$http, self.appUrlInfo.storeId, self.appUrlInfo.tableId);
					break;
				case 2:
				{
					_tabledata = yield Table.getTabledata(self.$http, self.appUrlInfo.storeId, "wxinitByStoreId");

					if(_tabledata &&　_tabledata.success == true){
						let result = yield api.getOrderList({
							openid: self.order.openid,
							storeId: self.order.storeId
						});
						if(result.data.code!=200){
							self.startInfo.error = true;
							self.startInfo.msg = "获取历史订单失败，联系商家";
							return;
						}
						//对获取的订单做处理
						const orderList = result.data.data;
						if(orderList&&orderList.length>0){
							orderList.forEach((v,i)=>{
								v.orderDetailId = i;
								Order.setProcessStatus(v, v.processStatus);
								if(v.status=="settled"){
									api.getOrderByWechat(v.id).then(value=>{
										if(value.code!=200){
											v.processStatus.addDetailCancel();
										} else {
											v.processStatus.addDetailFail();
										}
									}).catch(value=>{
										alert(value);
									})
								}

								if (v.status!="settled"&&v.extended&&v.extended.refundExpiration>0){
									checkOrder(v.extended.refundExpiration, v.orderNo)
									.then(v=>{
										v.processStatus.addDetailReceived(v.processStatus.detail[v.processStatus.detail.length]);
									})
									.catch(e=>{
										v.processStatus.addDetailFail();
										console.log(e)
									})
								}
							})
							self.allOrder = orderList;
							// self.$router.go({ name: 'order-list'});
							// self.isShowStartPage = false;
						}
					}

					self.startInfo.show = false;
					self.startInfo.error = true;



					break;
				}
				default:

			}

			if(!_tabledata ||　_tabledata.success == false){
				self.startInfo.error = true;
				self.startInfo.msg = _tabledata.message;
			}else if (_tabledata.data && _tabledata.data.subtotal>0){
				//返回上次点的数据
				// self.order = lodash.extend(self.order, _tabledata.data);
				self.order.headCount = _tabledata.data.headCount;
				// self.order.cart.items = _tabledata.data.cart.items;
				// debugger
				self.allOrder = _tabledata.data;
				// console.log(self.order);
				self.$router.go({ name: 'complete-order'});
				self.isShowStartPage = false;
			} else {
				if (_tabledata.data && _tabledata.data.headCount > 0){
					self.order.headCount = _tabledata.data.headCount;
				}
				self.startInfo.show = true;
			}
			this.appUrlInfo.tableName = _tabledata.data && _tabledata.data.tableName;
			this.appUrlInfo.storeName = _tabledata.data && _tabledata.data.storeName;
			this.appUrlInfo.merchantLogo = _tabledata.data && _tabledata.data.merchantLogo;

			setTimeout(function(){
					self.startInfo.error = true;
					self.startInfo.msg = self.startInfo.msg||"微信点单加载失败，请联系商家！";
			}, 10000);
			let inventories = new Inventories(this, this.appUrlInfo.storeId);
			self.categories = yield inventories.getCategories();
			self.inventories = yield inventories.getInventoriesGroupByCategories();
			self.contentShow  = true;
			document.title = self.appUrlInfo.storeName || "微信点单";

			//图片懒加载
			let lazyloadimg;
			setTimeout(function(){
				lazyloadimg = new LazyLoadImg({oScroll: '#inventories_content', elements: '.lazyload_img'});
			},1500);


			let _list = document.getElementById("inventories_content");
			self.styleObject.nav.listDom = _list;
			let _navHeight = [];
			self.styleObject.nav.navHeight = _navHeight;
			let l  = 0;
			setTimeout(function(){

				let _inventories_wrap = document.getElementById('inventories_wrap');
				let dlCollection = _inventories_wrap.getElementsByTagName('dl');
				// debugger todo margin-height 获取这个高度，包含margin padding
				self.styleObject.nav.scrollHeight = _inventories_wrap.scrollHeight + 50;
				self.styleObject.nav.height = _list.clientHeight;
				self.appUrlInfo.window = {};
				self.appUrlInfo.window.height = window.innerHeight;
				Array.from(dlCollection).forEach(function(elem, i){
					_navHeight[i] = elem.offsetTop;
					l  = _navHeight.length;
				});
			},500)

      //nav index
			let _nav = self.styleObject.nav;
			let _nav_title = document.getElementById("nav_title")&&document.getElementById("nav_title").style;
			document.getElementById("inventories_content").addEventListener("scroll",lodash.throttle(function(){
				for (let i = 0; i < l; i++) {
					let _ = _navHeight[i] - _list.scrollTop + 44;
					//悬浮的情况
					// if(_ >= 44 && _ < 89){
					// 	_nav_title.top = (_ - 88)+  'px';
					// 	// console.log(_);
					// }
					if(  _ < 45){
						_nav.navIndex = i;
					} else if(_ >= 45 && _ < 90){
						 _nav.navIndex = i - 1;
					}
					// console.log(_);
				}
				// console.log(_list.scrollTop);
				// console.log(_list.scrollTop);
			}));

		},
	  components: {
	  	'top-nav': TopNav,
	  	'inventory-option-group': require('./inventory-option-group'),
	  	'shopping-cart': require('./shopping-cart.vue'),
	  	'start-page': require('./start-page.vue'),
	  	'confirm-order': require('./confirm-order.vue'),
	  	'inventory-info': require('./inventory-info.vue'),
	  	'complete-order': require('./complete-order.vue'),
			'mpj-toast':MpjToast,
			'toast':require('./../components/toast/toast'),
			'mpj-dialog': require('./../components/dialog/mpj-dialog')
		},
		route: {
			data: function ({ to,from,next,abort}) {
				console.log(from, to);

				if(from.name=="order-detail"&&to.name=="inventory-list"&&to.query.isShowShoppingCart==1){
					this.isShowShoppingCart = true;
					this.inventoryOptionGroup.show=false;
				}
				if(from.name=="inventory-list"){

					if(this.isBtn){
						this.isBtn=false;
						return next()
					}else {
						//这个页面返回
						// if(this.isShowShoppingCart){
						// 	this.isShowShoppingCart=false;
						// 	this.isBtn=true;
						// 	 this.$router.replace({name:"inventory-list"});
						// 	 return abort();
						// }else {
							this.$router.go({name:"start-page"});
							return next();
						// }
					}
				}
			},
			canDeactivate : function(transition){
				debugger
				// if(transition.to.params.show){
				// 	transition.next()
				// }else {
				// 	transition.abort("inventory-list canDeactivate")
				// }
			}
		},
		methods: {
			toNavContent: function*(categoryId, categoryIndex){
				let _categoryClass = 'category_' + categoryId;
				let _nav = this.styleObject.nav;
				_nav.navIndex = categoryIndex;
				if(_nav.navHeight[categoryIndex] != _nav.listDom.scrollTop){
					let _o = document.getElementById(_categoryClass);
					// scrollIntoViewIfNeeded
					_o.scrollIntoView(true);
				}
			},
			addInventory: function(inventory){
				// debugger
				// console.log(new Date().getTime())
				const self = this;
				// console.log(inventory.name);
				if (!self.order.cart.addInventory(inventory)){
					//弹出选项卡
					self.inventoryOptionGroup.inventory = inventory;
					self.inventoryOptionGroup.show=true;
				}
				// console.log(new Date().getTime())
		 	},
			subtrackInventory: function(inventory){
				const self = this;
				// console.log(inventory.name);
				self.order.cart.subtrackInventory(inventory);
			},
			transformIsShowCart:function(){
				if(!this.order.cart.qty){
					return;
				}
				this.isShowShoppingCart = !this.isShowShoppingCart;
			},
			transformIsShowConfirmOrder: function(){
				// debugger
				this.isShowConfirmOrder = true;
				this.isShowShoppingCart = false;
				this.isBtn = true;
				this.$router.go({ name: 'confirm-order',params:{show:true}});
			},
			toInventoryInfo: function(inventory){
				// debugger
				this.isBtn=true;
				this.inventoryInfo.inventory = inventory;
				this.inventoryInfo.show = !this.inventoryInfo.show;
				this.$router.go({ name: 'inventory-info'});
			}
		}
	})
</script>
